/*
 * Copyright (c)  2018, XiQiao
 * All rights reserved. 
 *
 * Id:EmailValidator.java   2018-07-26 20:52 wanglijun
 */
package io.marmot.poi.validator;

import io.marmot.poi.util.ValidatorUtil;

/**
 * <p>
 * Title:
 * </p>
 * <p>
 * Description:
 * </p>
 * <p>
 * Copyright: Copyright (c) 2018
 * </p>
 * <p>
 * Company: XiQiao
 * </p>
 *
 * @author: wanglijun
 * @create: 2018-07-26 20:52
 * @version：1.0
 */
public class EmailValidator  implements Validator {


    /**
     * 验证单元格的值, 若验证失败, 请返回错误消息.
     *
     * @param value
     * @return null or errorMessage
     */
    @Override
    public String valid(Object value) {
        String valueString = (String) value;
        return ValidatorUtil.isEmail(valueString) ? null : "[" + valueString + "]不是正确的EMail.";
    }
}
